<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRechargesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('recharges', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')->comment('用户ID');
            $table->char('order_no', 30)->comment('充值订单');
            $table->tinyInteger('type')->nullable()->default(0)->comment('充值类型，0:支付宝，1：银行卡');
            $table->decimal('price', 10, 2)->comment('充值金额');
            $table->decimal('real_price', 10, 2)->nullable()->default(null)->comment('实际到账');
            $table->tinyInteger('verify_status')->nullable()->default(0)->comment('审核状态，0:待审核，1：审核通过，-1:审核拒绝');
            $table->string('remark', 256)->nullable()->default('')->comment('备注');
            $table->timestamps();
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('recharges');
    }
}
